<?php
namespace app\index\controller;
use think\Log;

use think\Controller;
use think\Model;
use think\Db;
use think\request;
class Logs extends Base
{
    public  function index(){

     /*   Log::record('erro','error');
        trace('1111','error');
        return view();*/
        $LogRes = Model('Log')->GetLog();

       // var_dump($LogRes);exit();
        $this->assign('LogRes',$LogRes);
        return $this->fetch('logs/index');
    }

    public function layindex(){
        return $this->fetch('logs/index');
    }
    /***
     * log 数据接口
     */
    public function logsData(){
        $res = Db::table('xt_log_a')->select();
        return layshow('0','success',20,$res);
    }

    /***
     * log  查询
     */
    public function LogSearch(){

        /*$request = Request::instance();*/
        $logstext = $this->request->param('logstext');
       /* if(empty($logstext)){
            $this->error('index');
        }*/
        $logstext = '%'.$logstext.'%';
        $aa['user'] = ['like',$logstext];
        $aa['log'] = ['like',$logstext];
        $aa['ybid'] = ['like',$logstext];
        $aa['createdate'] = ['like',$logstext];
        $cc = Db::table('xt_log_a')->whereOr($aa)->order('id desc')->paginate(10);
        /*halt($cc);*/
        $this->assign('LogResSea',$cc);
        return view('logs/LogSearch');
    }
}